<template>
  <div class="last-select">
    <div
      v-for="item in options"
      :key="item"
      class="last-select-item"
      :class="{ active: modelValue === item }"
      @click="emit('change', item)">
      <span>最近 {{ getStrBySecond(item) }}</span>
    </div>
  </div>
</template>

<script setup lang="ts">
import type { LastSelectOptions } from './types'
import { getStrBySecond } from './utils'

defineProps<{
  options: LastSelectOptions
  modelValue?: number
}>()

const emit = defineEmits<{
  change: [value: number]
}>()
</script>
